/**
 * 
 */
package org.extdev.connection.serialport;

import gnu.io.SerialPort;

/**
 * @author LAP
 *
 */
public class SerialPortPreferences {
	
	public SerialPortPreferences(){
	}
	
	public SerialPortPreferences(String portName){
		this.setPortName(portName);
	}
	
    //constants
    public static final String DEFAULT_PORT_NAME = "COM7";
    public static final int DEFAULT_SPEED = 115200;
    public static final int DEFAULT_DATABITS = SerialPort.DATABITS_8;
    public static final int DEFAULT_STOPBITS = SerialPort.STOPBITS_1;
    public static final int DEFAULT_PARITY = SerialPort.PARITY_NONE;
    public static final int DEFAULT_TIMEOUT = 50;//в примерах которые я видел обычно такое число использовали
    
    private String portName = DEFAULT_PORT_NAME;
    private int TIMEOUT = DEFAULT_TIMEOUT;
    private int speed = DEFAULT_SPEED;
    private int dataBits = DEFAULT_DATABITS;
    private int stopBits = DEFAULT_STOPBITS;
    private int parity = DEFAULT_PARITY;
    
    
    public int getTIMEOUT() {
        return TIMEOUT;
    }

    public void setTIMEOUT(int TIMEOUT) {
        this.TIMEOUT = TIMEOUT;
    }

    public int getSpeed() {
        return speed;
    }

    public void setSpeed(int speed) {
        this.speed = speed;
    }

    public int getDataBits() {
        return dataBits;
    }

    public void setDataBits(int dataBits) {
        this.dataBits = dataBits;
    }

    public int getParity() {
        return parity;
    }

    public void setParity(int parity) {
        this.parity = parity;
    }

    public int getStopBits() {
        return stopBits;
    }

    public void setStopBits(int stopBits) {
        this.stopBits = stopBits;
    }

	/**
	 * @return the portName - String name of the port
	 */
	public String getPortName() {
		return portName;
	}

	/**
	 * @param portName the  to set
	 */
	public void setPortName(String portName) {
		this.portName = portName;
	}
}
